<template>
  <div class="wraper">
    <top-banner :tabBanner="banners"></top-banner> 
    <huo-dong></huo-dong>
    <fu-li v-if="dataLoad" :articles="articles" :load="dataLoad"></fu-li>
    <prefecture v-if="dataLoad" :skill="skill"></prefecture>
    <tab></tab>
  </div>
</template>

<script>
import TopBanner from "@/base/topBanner/topBanner";
import HuoDong from "@/components/homePage/huoDong";
import FuLi from "@/components/homePage/fuLi";
import Prefecture from "@/components/homePage/prefecture";
import Tab from "@/base/tab/tab";
export default {
  data() {
    return {
      dataLoad: false,
      banners: [],
      articles: [],
      skill: {},
      data: []
    };
  },
  mounted() {
    this.$nextTick(() => {
      this.dataLoad = true;
      // this.submitForm();
      this.get();
    });
  },
  methods: {
    get() {
      this.$axios
        .get(process.env.baseUrl + "/web-avicare-1.0/h5/indexcontent")
        .then(res => {
          if (res.data.success) {
            this.dataLoad = true;
            this.banners = res.data.func_articles.banners;
            this.skill = res.data.func_mall.skill;
            this.articles = res.data.func_articles.articles;
          }
        })
        .catch(error => {
          console.log(error);
        })
    },
    submitForm() {
      this.$http
        .post(process.env.baseUrl + "/web-avicare-1.0/h5/indexcontent")
        // .jsonp("https://dev.avicare.cn/web-avicare-1.0/h5/indexcontent")
        .then(res => {
          if (res.data.success) {
            this.dataLoad = true;
            this.banners = res.data.func_articles.banners;
            this.skill = res.data.func_mall.skill;
            this.articles = res.data.func_articles.articles;
          }
        })
        .catch(error => {
          console.log(error);
        });
    }
  },
  components: {
    TopBanner,
    HuoDong,
    FuLi,
    Prefecture,
    Tab
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" scoped>
.wraper{
  overflow: hidden;
  margin-bottom: 1rem;
}
</style>
